const path = require("path");
const resolve = (dir) => {
  return path.join(__dirname, dir);
};
module.exports = {
  //配置别名
  chainWebpack: (config) => {
    config.resolve.alias
      .set("@", resolve("src"))
      .set("_c", resolve("src/components"));
  },
  configureWebpack: {
    devtool: "eval-source-map",
  },
  publicPath: "./",
  devServer: {
    overlay: {
      // 让浏览器 overlay 同时显示警告和错误
      warnings: true,
      errors: true,
    },
    // host: 'localhost',
    //port: 8080, // 端口号
    https: false, // https:{type:Boolean}
    open: true, //配置后自动启动浏览器
    hotOnly: true, // 热更新
    // 配置跨域处理,只有一个代理
    // proxy: 'http://localhost:8080'
    proxy: {
      //配置多个代理
      "/qcj/api/": {
        // target: "http://192.168.60.17:18888",
        //target: "http://192.168.6.79:18888",
        //target: "http://test.ymflow.cn",
        target: "http://www.ymflow.cn",
        changeOrigin: true,
        ws: true, //websocket支持
        secure: false,
        /*  pathRewrite: {
          '^/qcj/api/': '/',
        }, */
      },
      "/api/": {
        //target: 'http://yd-demo-admin.jason001.top',
        target: "http://test.ymflow.cn",
        changeOrigin: true,
        ws: true, //websocket支持
        secure: false,
      },
    },
  },
};
